package com.net.xpay.web.secutiry;

import org.springframework.security.core.AuthenticationException;

/**
  on 06/02/2018.
 * 登陆相关的异常,spring security只能抛出AuthenticationException的子类.
 * see {@link FormLoginAuthenticationProvider}
 */
public class WebAuthenticationException extends AuthenticationException {
    private String errorCode; //出错的errorCode

    private String errorMessage; //出错的message

    WebAuthenticationException(String errorCode, String errorMessage) {
        super(errorMessage);
        this.errorCode = errorCode;
        this.errorMessage = errorMessage;
    }

    public String getErrorCode() {
        return errorCode;
    }

    public String getErrorMessage() {
        return errorMessage;
    }

    @Override
    public String toString() {
        return "|WebAuthenticationException|errorCode=" + errorCode + "|errorMessage=" + errorMessage;
    }

    @Override
    public String getMessage() {
        return "|WebAuthenticationException|errorCode=" + errorCode + "|errorMessage=" + errorMessage;
    }
}
